#include <stdio.h>
#include <string.h>

#define BUFFER_SIZE 16
int main()
{
    /*
    char buffer[BUFFER_SIZE];
    memset(buffer, 0, sizeof(buffer));
    printf("buffer:%s\n", buffer);//字符串打印

    */
#if 0
    //赋值方式一
    buffer[0] ='h';
    buffer[1] ='e';
#endif

#if 0
    //赋值方式2,不安全
    strcpy(buffer, "hello word");
#endif

#if 0
    //赋值方式3 ---常用
    char buffer2[BUFFER_SIZE] = "hello word";
    printf("buffer2:%s\n",buffer2);

#endif

#if 1
    //赋值方式四---直接赋值，考试会考
    char buffer3[BUFFER_SIZE] = {'h', 'e', 'l', 'l', 'o'};
    printf("buffer3:%s\n", buffer3);
#endif


#if 1
    char buffer[BUFFER_SIZE] = "hello world";
    int Len = sizeof(buffer);
    int  len = strlen(buffer);
    printf("Len:%d\t, len::%d\n", Len, len);

#endif


#if 0
    char buffer[BUFFER_SIZE] = "hello world";
    int Len = sizeof(buffer);
    int len = strlen(buffer);
    printf("Len:%d\t, len::%d\n", Len, len);

#endif

#if 0
    char buffer[] = "hello world";
    int Len = sizeof(buffer);
    int len = strlen(buffer);
    printf("Len:%d\t, len::%d\n", Len, len);

#endif

#if 0
    /*特殊情况*/
    char buffer3[] = {'h', 'e', 'l', 'l', 'o'};
    Len = sizeof(buffer3);
    len = strlen(buffer3);
    printf("Len:%d\t, len::%d\t  buffer3:%s\n", Len, len ,buffer3);
#endif
    return 0;

}















